﻿using Rebex.Security;
using System;
using System.Collections.Generic;
using System.Text;

namespace TL_Cloud.Utils
{
    /// <summary>
    /// 文件加密
    /// </summary>
    public class FileEncryptHelper : RebexBase
    {
        private string password;
        public FileEncryptHelper(string password)
        {
            this.password = password;
        }

        public void Decrypt(string srcFile, string descFile)
        {
            Rebex.Security.FileEncryption fileEncryption = new Rebex.Security.FileEncryption();

            fileEncryption.OverwriteExistingFile = true;
            fileEncryption.EncryptionAlgorithm = FileEncryptionAlgorithm.AesCbc;
            fileEncryption.EncryptionKeySize = 128;
            fileEncryption.SetPassword(password);
            fileEncryption.Encrypt(srcFile, descFile);
        }

    }
}
